using UnityEngine;
using Voodoo.Pattern;

public class LevelOrientation : MonoBehaviour
{
	private LevelPosType levelPosType;

	[SerializeField]
	private Transform OilTank;

	[SerializeField]
	private GameObject _rightExcavator;

	[SerializeField]
	private GameObject _leftExcavator;

	[SerializeField]
	private GameObject _archExcavator;

	[SerializeField]
	private GameObject _toptExcavator;

	[SerializeField]
	private GameObject _railExcavator;

	[Space]
	[SerializeField]
	private Transform _rightOilTankTransform;

	[SerializeField]
	private Transform _leftOilTankTransform;

	[SerializeField]
	private Transform _archOilTankTransform;

	[SerializeField]
	private Transform _topOilTankTransform;

	[Space]
	[SerializeField]
	private Transform _rightStickTransform;

	[SerializeField]
	private Transform _leftStickTransform;

	[SerializeField]
	private Transform _archStickTransform;

	[SerializeField]
	private Transform _topStickTransform;

	[SerializeField]
	private Transform _railStickTransform;

	[Space]
	[SerializeField]
	private Transform _map;

	[SerializeField]
	private Transform _leftBoard;

	[SerializeField]
	private Transform _rightBoard;

	[SerializeField]
	private Transform _left2Board;

	[SerializeField]
	private Transform _right2Board;

	[Space]
	[SerializeField]
	private Transform _leftTreadmill;

	[SerializeField]
	private Transform _rightTreadmill;

	[Space]
	[SerializeField]
	private Transform _levelObject;

	[SerializeField]
	private GameObject _blueCubeObject;

	private void Start()
	{
	}

	public void DetermineLevelPosType(LevelPosType levelPosType = LevelPosType.Right)
	{
		if (SingletonMB<DuelModeManager>.Instance != null)
		{
			_railExcavator.SetActive(value: false);
			return;
		}
		_blueCubeObject.SetActive(levelPosType != LevelPosType.Rail);
		Object.FindObjectOfType<Cam>().SetCameraSide(levelPosType);
		Object.FindObjectOfType<GameManager>().SetCameraAnimationSide(levelPosType);
		_rightExcavator.SetActive(value: false);
		_leftExcavator.SetActive(value: false);
		_archExcavator.SetActive(value: false);
		_toptExcavator.SetActive(value: false);
		_railExcavator.SetActive(value: false);
		Upgrade upgrade = Object.FindObjectOfType<Upgrade>();
		switch (levelPosType)
		{
		case LevelPosType.Right:
			_rightExcavator.SetActive(value: true);
			_leftTreadmill.gameObject.SetActive(value: false);
			_rightTreadmill.gameObject.SetActive(value: true);
			upgrade._stickPosition = _rightStickTransform.position;
			upgrade._stickRotation = _rightStickTransform.localRotation;
			OilTank.transform.position = _rightOilTankTransform.position;
			OilTank.transform.localRotation = _rightOilTankTransform.localRotation;
			_leftBoard.transform.localPosition = new Vector3(-3.48f, 5.27f, 0f);
			_rightBoard.transform.localPosition = new Vector3(11.16f, 5.27f, 0f);
			_map.localScale = Vector3.one;
			_map.position = Vector3.zero;
			_levelObject.localScale = new Vector3(-1f, 1f, 1f);
			break;
		case LevelPosType.Left:
			_leftExcavator.SetActive(value: true);
			_leftTreadmill.gameObject.SetActive(value: true);
			_rightTreadmill.gameObject.SetActive(value: false);
			upgrade._stickPosition = _leftStickTransform.position;
			upgrade._stickRotation = _leftStickTransform.localRotation;
			OilTank.transform.position = _leftOilTankTransform.position;
			OilTank.transform.localRotation = _leftOilTankTransform.localRotation;
			_leftBoard.transform.localPosition = new Vector3(-12.87f, 5.27f, 0f);
			_rightBoard.transform.localPosition = new Vector3(2.48f, 5.27f, 0f);
			_map.localScale = new Vector3(-1f, 1f, 1f);
			_map.position = new Vector3(-1.48f, 0f, 0f);
			_levelObject.localScale = new Vector3(1f, 1f, 1f);
			if ((bool)_left2Board)
			{
				_left2Board.transform.localPosition = new Vector3(-13.81f, 2.84f, 0f);
				_right2Board.transform.localPosition = new Vector3(5f, 2.84f, 0f);
			}
			break;
		case LevelPosType.Arch:
			_archExcavator.SetActive(value: true);
			_leftTreadmill.gameObject.SetActive(value: true);
			_rightTreadmill.gameObject.SetActive(value: true);
			upgrade._stickPosition = _archStickTransform.position;
			upgrade._stickRotation = _archStickTransform.localRotation;
			OilTank.transform.position = _archOilTankTransform.position;
			OilTank.transform.localRotation = _archOilTankTransform.localRotation;
			_leftBoard.transform.localPosition = new Vector3(-7f, 5.27f, 0f);
			_rightBoard.transform.localPosition = new Vector3(7f, 5.27f, 0f);
			_map.localScale = Vector3.one;
			_map.position = Vector3.zero;
			_levelObject.localScale = new Vector3(1f, 1f, 1f);
			break;
		case LevelPosType.Top:
			_toptExcavator.SetActive(value: true);
			_leftTreadmill.gameObject.SetActive(value: true);
			_rightTreadmill.gameObject.SetActive(value: true);
			upgrade._stickPosition = _topStickTransform.position;
			upgrade._stickRotation = _topStickTransform.localRotation;
			OilTank.transform.position = _topOilTankTransform.position;
			OilTank.transform.localRotation = _topOilTankTransform.localRotation;
			_leftBoard.transform.localPosition = new Vector3(-7f, 5.27f, 0f);
			_rightBoard.transform.localPosition = new Vector3(7f, 5.27f, 0f);
			_map.localScale = Vector3.one;
			_map.position = Vector3.zero;
			_levelObject.localScale = new Vector3(1f, 1f, 1f);
			break;
		case LevelPosType.Rail:
			_railExcavator.SetActive(value: true);
			_leftTreadmill.gameObject.SetActive(value: false);
			_rightTreadmill.gameObject.SetActive(value: true);
			upgrade._stickPosition = _railStickTransform.position;
			upgrade._stickRotation = _railStickTransform.localRotation;
			OilTank.transform.position = _topOilTankTransform.position;
			OilTank.transform.localRotation = _topOilTankTransform.localRotation;
			_leftBoard.transform.localPosition = new Vector3(-7f, 5.27f, 0f);
			_rightBoard.transform.localPosition = new Vector3(20f, 5.27f, 0f);
			_map.localScale = Vector3.one;
			_right2Board.transform.localPosition += new Vector3(10f, 0f, 0f);
			_map.position = Vector3.zero;
			_levelObject.localScale = new Vector3(1f, 1f, 1f);
			break;
		}
		upgrade.UpdateLong();
	}
}
